#ifndef ANIMATEDBACKGROUND_H
#define ANIMATEDBACKGROUND_H

#include <QWidget>
#include <QPixmap>
#include <QPropertyAnimation>

class AnimatedBackground : public QWidget
{
  Q_OBJECT
  Q_PROPERTY(qreal animationAlpha READ animationAlpha WRITE setAnimationAlpha)

  QPixmap _background;
  QPixmap _oldBackground;
  QPropertyAnimation* _currentAnimation;
  qreal _animationAlpha;

public:
  explicit AnimatedBackground(QWidget *parent = 0);

  qreal animationAlpha() const;
  
public slots:
  void setBackground(const QString& path);

protected slots:
  void setAnimationAlpha(qreal a);
  void animationFinished();

protected:
  void paintEvent(QPaintEvent *);
};

#endif // ANIMATEDBACKGROUND_H
